home *** CD-ROM | disk | FTP | other *** search
/ Wonky Flux Batch 2019 02 / Wonky_Flux_Batch_2019-02.zip / Wonky Flux Batch 2019-02 / 072 - EXFER 4.1 4.2.dsk / EXFER.AUX.2.txt next >
Text File  |  2019-02-17  |  12KB  |  390 lines

  1. ;**********************
  2. ;*                    *
  3. ;*    EXfer.aux.2     *
  4. ;*                    *
  5. ;**********************
  6.  
  7. ; Written to fix the info problems and to provide a way
  8. ; to 'move' files to the correct directories, the actual
  9. ; moving of the files will not be done, but the file info
  10. ; and directory entry will be moved.
  11.  
  12. ; This will also allow you to edit several things that
  13. ; were previously uneditable.
  14.  
  15. ; To add this to your EXfer 4.1 add a '2' command to the
  16. ; list in EXFER.SEG.S with something like:
  17.  
  18. ; if i$="2" and (info(5)) pop:link "a:exfer.aux.2"
  19.  
  20. ; *** I used A1: instead of D: for the download drive specifier
  21.  
  22. ;  ------> jp Specifers Replaced (d: in place of a1:)  9-27-88
  23.  
  24. ; WARNING: I wouldn't reccomend using this if you might lose
  25. ;          carrier during the 'fix' routine, I have no idea
  26. ;          of what damage could occur.  Back-up your XV and
  27. ;          DV files before using this program for the first
  28. ;          time.
  29.  
  30. ; Way back when version 1.2 came out there was a doc file that
  31. ; showed how the files were organized, since I am attempting to
  32. ; put in what I thought was left out, here they are, not in it's
  33. ; entirety, but enough to see what's happening.
  34.  
  35. ;             STRUCTURE OF THE XV.# FILES
  36. ;             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  37.  
  38. ; Filename: XV.n (were "N" is a library number)
  39. ; Contents: Library & download specific information
  40. ;   Length: Each record is 32 bytes long
  41.  
  42. ; Records 0 and 1 are combined to form one 64 byte record.  These
  43. ; 64 bytes contain information relating to the overall volume and
  44. ; its operating parameters:
  45.  
  46. ; RECORDS 0 & 1 (64 Bytes) - Library Information
  47.  
  48. ; OFFSET        DESCRIPTION                      PROGRAM REFERENCE
  49. ; ---------------------------------------------------------------
  50. ; Bytes  0-30:  Directory name (padded) + [CR]   BN$
  51. ; Bytes 31-35:  U/D drive specifier + [CR]       BF$
  52. ;          ^^ about, the next five bytes are after the CR
  53. ; Byte     36:  Access level                     B2 or BYTE(0)
  54. ; Byte     37:  Download level                   B3 or BYTE(1)
  55. ; Byte     38:  Upload level                     B4 or BYTE(2)
  56. ; Byte     39:  Auto-validation flag (255=True)  BYTE(3)
  57. ; Byte     40:  Number of entries in this file   BYTE(4)
  58. ; Bytes 41-42:  Librarian high & low bytes       B1 or BYTE(5)+BYTE(6)
  59. ; Byte     43:  Upload credit                    UM or BYTE(7)
  60. ; Byte     44:  Download credit                  DM or BYTE(8)
  61. ; Bytes 45-63:  -- Unused --
  62.  
  63. ; Following these first two records are file entries, which occupy
  64. ; records 2 up to 254:
  65.  
  66. ; RECORDS 2 - X (32 bytes each) - File entries
  67.  
  68. ; OFFSET       DESCRIPTION                       PROGRAM REFERENCE
  69. ; ----------------------------------------------------------------
  70. ; Bytes  0-15: Filename (Padded) + [CR]          F$
  71. ; Bytes 16-19: Filetype + [CR]                   TY$
  72. ; Byte     20: File validity                     BYTE(9)
  73. ; Bytes 21-22: File size, high & low bytes       BYTE(10)+BYTE(11)
  74. ; Bytes 23-24: Uploader #, high & low bytes      BYTE(12)+BYTE(13)
  75. ; Bytes 25-26: Description #, high & low bytes   BYTE(14)
  76. ; Bytes 27-28: Date file was uploaded            WHEN$
  77. ; Byte     29: # of times downloaded             BYTE(18)
  78. ; Bytes 30-31: -- Unused --
  79.  
  80. ; NOTE: The description allows more than 255 descriptions, but
  81. ;       there can be only 254 files in the library, strange...
  82.  
  83.  ready d2$
  84. prompt
  85.  on nocar goto terminate
  86.  x=(clock(2)-clock(1))/60:x$=right$("0"+str$(x),2)
  87.  if x=0 then x$="--":else if (info(5)) or (clock(1)=0) then x$="::"
  88.  free:clear key:print \"["x$"] Aux.2 ->";
  89.  if zz=1 then zz=0:goto command
  90.  if zz=3 goto command:else get i$:print chr$(8)" ";chr$(8);
  91.  
  92. ; check for normal command
  93.  
  94. command
  95.  push prompt
  96.  if i$="F" pop:goto fixit
  97.  if i$="M" goto moveit
  98.  if i$="E" goto edinfo
  99.  if i$="?" or i$="/" goto help
  100.  if i$="Q" pop:link "a:exfer.seg","prompt"
  101.  
  102. ; not a command
  103.  print " "chr$(8);:return
  104.  
  105. help
  106.  print\\'
  107. *********************
  108. *    Exfer.aux.2    *
  109. *  by David Kirsch  *
  110. *-------------------*
  111. *  F)ix info files  *
  112. *  M)ove file       *
  113. *  E)dit entry      *
  114. *  Q)uit            *
  115. *********************
  116. '\\:return
  117.  
  118. ; Fix the info file
  119. ; ~~~~~~~~~~~~~~~~~
  120.  
  121. fixit
  122.  print "Fix"
  123.  print \\"Checking entries against infos"
  124.  store "d:var2"
  125.  on nocar:
  126.  print \"File entries = "d1$
  127.  print "Info file    = "d2$
  128.  close
  129.  ready d2$
  130.  open #1,d1$: for l=1 to byte(4):f$=""
  131.  position #1,32,l+1:input #1,f$:input #1,ty$
  132.  position #1,32,l+1,20:read #1,ram2+9,10:if f$="" next:goto fix.1
  133.  if not(byte(14)) next:goto fix.1
  134.  input #msg(byte(14)),z:input #6,i$
  135.  if f$=i$ next:goto fix.1
  136.  print l+1". "f$"  "i$
  137.  byte(14)=0:byte(15)=0:na$=f$:nb=l:close:gosub write:open #1,d1$
  138.  next
  139.  
  140. ; fix bad messages (info)
  141.  
  142. fix.1
  143.  close
  144.  print \\"Checking for bad infos"
  145.  for i=1to msg(0)
  146.  if not(msg(i)) next goto fix.2
  147.  input #msg(i),z:input #6,i$
  148.  if len(i$)=15 next:goto fix.2
  149.  print i
  150.  kill #msg(i):update
  151.  next
  152.  
  153. ; Fix the remaining infos
  154.  
  155. fix.2
  156.  print \\"Checking remaining info against entries"
  157.  for i=1to msg(0)
  158.  if not(msg(i)) next:goto fix.done
  159.  input #msg(i),z:input #6,i$
  160.  gosub read
  161.  if l=0 kill #msg(i):update:print i$" not found.":next:goto fix.done
  162.  if byte(14)=i next:goto fix.done
  163.  if byte(14) kill #msg(i):update:print i$" duplicate deleted":next:goto fix.done
  164.  byte(14)=i:byte(15)=0:na$=f$:nb=l:gosub write
  165.  print f$" added."
  166.  next
  167.  
  168. fix.done
  169.  close
  170.  recall "d:var2":kill "d:var2"
  171.  goto prompt
  172.  
  173. ; Move entry (& info) to another library
  174. ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  175.  
  176. moveit
  177.  d=0:input @2 \"Move file: " i$:if i$="" return:else na$=i$
  178.  if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto move1
  179.  i$=left$(i$+chr$(32,14),15):gosub read
  180.  if not(l) goto nfile
  181.  
  182. move1
  183.  if l<0 goto nfile
  184.  kill "d:temp":create "d:temp":open #1,"d:temp"
  185.  print #1,f$:print #1,ty$:for i=9 to 18:print #1,byte(i):next
  186.  d=byte(14):if d copy #msg(d),#1
  187.  close
  188.  
  189. move2
  190.  print "Copy "f$" from library "bb
  191.  input @2"   to library [?]..." i$:if i$="" return
  192.  if i$="?" goto move3:else a=val(i$)
  193.  if (a<1) or (a>255) print \"XT: "chr$(7)"That library doesn't exist":return
  194.  ob=bb:bb=a:gosub log:if bf$="" then l=bb:gosub biterr:print '
  195. XT: 'chr$(7)"That library doesn't exist":bb=ob:goto log
  196.  
  197.  i$=f$:gosub read
  198.  if l print "Duplicate file name"chr$(7):bb=ob:goto log
  199.  gosub getslt:if nb=255 gosub dfull:bb=ob:goto log
  200.  open #1,"d:temp"
  201.  input #1,f$:input #1,ty$
  202.  for i=9 to 18: input #1,x:byte(i)=x:next:d=byte(14)
  203.  if d a=1:gosub findinfo:byte(14)=d:copy #1,#msg(d):msg(d)=255:update
  204.  close:kill "d:temp":na$=f$:if nb<>byte(4) gosub write:else gosub update
  205.  bb=ob:goto log
  206.  
  207. move3
  208.  print screen$"XT: You may access the following..."\\s$\
  209.  open #1,"d:xt.bitmap":read #1,ed+1,255:close
  210.  open #1,"d:xt.volumes":for l=1 to 255
  211.  setint(1):x=peek(ed+l):if key(1) then l=255:next:goto move3.1
  212.  if x>34 next:goto move3.1
  213.  
  214.  position #1,32,l:input #1,x$
  215.  print "["right$("00"+str$(l),3)"]: "x$:next
  216.  
  217. move3.1
  218.  close:setint(""):print:clear key:goto move2
  219.  
  220. ; Edit the uneditable info & directory entry
  221. ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  222.  
  223. edinfo
  224.  d=0:input @2 \"Edit file: " i$:if i$="" return:else na$=i$
  225.  if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto editit
  226.  i$=left$(i$+chr$(32,14),15):gosub read
  227.  if not(l) goto nfile
  228.  
  229. editit
  230.  print \"(I)nfo or (E)ntry: ";:get i$
  231.  if i$="I" or i$="i" goto edin.x
  232.  if i$="E" or i$="e" goto edentry
  233.  return
  234.  
  235. edin.x
  236.  if l<0 goto nfile:else c=byte(12)+byte(13)*256:d=byte(14)
  237.  if not(d) print xt$;chr$(7)"File has no information":return
  238.  input #msg(d),a:input #6,x$\y$\z$:copy #6,#8
  239.  
  240. edin.2
  241.  print \\"A. Uploaded by: User #"a
  242.  print "B.    Filename: "x$
  243.  print "C.    "y$
  244.  print "D.    "z$
  245.  print \"A-D: ";:input @2 i$
  246.  if i$="A" input "User #" a:goto edin.2
  247.  if i$="B" input "Filename: " x$:goto edin.2
  248.  if i$="C" input "Uploader: " y$:y$="Uploader: "+y$:goto edin.2
  249.  if i$="D" input "Uploaded: " z$:z$="Uploaded: "+z$:goto edin.2
  250.  
  251.  print "Save (y/N): ";:get i$:if i$<>"Y" and i$<>"y" return
  252.  edit(0)
  253.  input #msg(d),i:input #6,i$\i$\i$\i$:copy #6,#8:kill #msg(d)
  254.  print #msg(d),a:print #6,x$\y$\z$\:copy #8,#6
  255.  msg(d)=255:update:close:return
  256.  
  257. edentry
  258.  print \\"A. Filename: "f$
  259.  print "B. File type: "ty$
  260.  print "C. Valid file: ";:if byte(9) print "YES": else print "NO"
  261.  print "D. Uploader # "byte(12)+byte(13)*256
  262.  print "E. Date: "when$" (updates to current date)"
  263.  print "F. Downloaded "byte(18)" times." 
  264.  print \"A-F: ";:input @2 i$
  265.  if i$="A" input "Filename: " f$:goto edentry
  266.  if i$="B" input "File type: " ty$:goto edentry
  267.  if i$="C" byte(9)=not(byte(9)):goto edentry
  268.  if i$="D" input "Uploader #" a:byte(13)=a/256:byte(12)=a mod 256:goto edentry
  269.  if i$="E" print "Date: " date$: when$ = "x": goto edentry
  270.  if i$="F" input "Downloaded: " a:byte(18)=a:goto edentry
  271.  
  272.  print "Save (y/N): ";:get i$:if i$<>"Y" and i$<>"y" return
  273.  na$=f$:nb=l:goto write
  274.  return
  275.  
  276. ; SUBROUTINE - find an empty message entry
  277.  
  278. findinfo
  279.  if msg(a) then a=a+1:else d=a:return
  280.  if a>msg(0) then d=a:return
  281.  goto findinfo
  282.  
  283. ; Terminate connection
  284. ; ~~~~~~~~~~~~~~~~~~~~
  285.  
  286. terminate
  287.  byte=ram2:byte(0)=xm+(pt*8):byte(1)=1:byte(2)=cr mod 256:byte(3)=cr/256
  288.  open #1,"d:xt.users":position #1,4,un:write #1,ram2,4:close
  289.  poke ram2,v:when$=ram+20:if v=0 then byte=ram+29:goto term.1
  290.  byte=ram+37:nibble(3)=dl/256:byte(3)=dl mod 256
  291.  nibble(4)=ul/256:byte(4)=ul mod 256
  292.  
  293. term.1
  294.  clear:recall "a:variables":kill "a:variables"
  295.  if x=13 then ul=byte(4)+nibble(4)*256:dl=byte(3)+nibble(3)*256
  296.  link "a:main.seg","termin2"
  297.  
  298. ; :::::::::::::
  299. ; directory I/O
  300. ; :::::::::::::
  301.  
  302. ; log to a library and get some dir info
  303. ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  304.  
  305. log
  306.  byte=ram2:fill ram2,32,0:bf$="":z$="d:xv."+str$(bb)
  307.  open #1,z$:input #1,bn$:input #1,bf$
  308.  read #1,ram2,9:close:b1=byte(5)+byte(6)*256
  309.  b2=1:if byte(0) then b2=flag(byte(0))
  310.  b3=1:if byte(1) then b3=flag(byte(1))
  311.  b4=1:if byte(2) then b4=flag(byte(2))
  312.  um=byte(7):dm=byte(8):lb=(un=b1)
  313.  if info(5) then lb=1:b2=1:b3=1:b4=1
  314.  d1$="d:xv."+str$(bb):d2$="d:dv."+str$(bb)
  315.  if bf$ ready d2$:bf$=left$(bf$,instr(":",bf$))
  316.  return
  317.  
  318. ; get an empty slot
  319. ; ~~~~~~~~~~~~~~~~~
  320.  
  321. getslt
  322.  nb=0:open #1,d1$:for l=1 to byte(4)
  323.  position #1,32,l+1:input #1,i$
  324.  if (i$="") and (nb=0) then nb=l:l=byte(4)
  325.  next:close:if not(nb) then nb=byte(4)
  326.  return
  327.  
  328. ; update "number of entries" counter
  329. ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  330.  
  331. update
  332.  byte(4)=byte(4)+1:open #1,d1$:print #1,bn$
  333.  print #1,bf$:write #1,ram2,9:close
  334.  
  335. ; write a directory entry
  336. ; ~~~~~~~~~~~~~~~~~~~~~~~
  337.  
  338. write
  339.  open #1,d1$:position #1,32,nb+1:print #1,na$
  340.  print #1,ty$:write #1,ram2+9,10:close
  341.  z=nb:return
  342.  
  343. ; read a directory entry
  344. ; ~~~~~~~~~~~~~~~~~~~~~~
  345.  
  346. read
  347.  open #1,d1$:for l=1 to byte(4)
  348.  position #1,32,l+1:input #1,f$
  349.  if instr(i$,f$)=1 then p=l:l=byte(4):next:l=p:goto read.1
  350.  next:close #1:l=0:return
  351.  
  352. read.1
  353.  input #1,ty$:read #1,ram2+9,10:close #1
  354.  return
  355.  
  356. ; read a file by slot #
  357. ; ~~~~~~~~~~~~~~~~~~~~~
  358.  
  359. nread
  360.  if left$(i$,1)="#" then i$=mid$(i$,2)
  361.  l=val(i$):if (l<2) or (l>253) then l=0:return
  362.  open #1,d1$:position #1,32,l
  363.  input #1,f$:if f$="" close #1:l=0:return
  364.  input #1,ty$:read #1,ram2+9,10:close #1
  365.  i$=f$:if pt=2 return:else print \"[#"l"]: "i$:return
  366.  
  367. ; :::::::::::::::::::::::::
  368. ; miscellaneous subroutines
  369. ; :::::::::::::::::::::::::
  370.  
  371. ; update errant bit-map
  372. ; ~~~~~~~~~~~~~~~~~~~~~
  373.  
  374. biterr
  375.  open #1,"d:xt.bitmap":read #1,ed+1,255:close
  376.  poke ed+l,255:open #1,"d:xt.bitmap"
  377.  write #1,ed+1,255:close:open #1,"d:xt.volumes"
  378.  position #1,32,l:print #1,chr$(13):close
  379.  return
  380.  
  381. ; ::::::::::::::
  382. ; error messages
  383. ; ::::::::::::::
  384.  
  385. dfull
  386.  print xt$;chr$(7)" Directory full...":return
  387.  
  388. nfile
  389.  print xt$;chr$(7)" No such file...":return
  390.